package com.qianyanglong.m3u8.exception;

public class M3U8Exception extends RuntimeException{

    private M3U8ExceptionType code;

    private String message;

    private Exception e;

    public M3U8Exception(M3U8ExceptionType code,String message){
        this.code = code;
        this.message = message;
    }

    public M3U8Exception(M3U8ExceptionType code,String message,Exception e){
        this.code = code;
        this.message = message;
        this.e = e;
    }

    public enum M3U8ExceptionType{

        NO_DIR_WRITE_ACCESS(100000,"无工作文件夹写权限"),

        NO_FILE_WRITE_ACCESS(100001,"无工作文件写权限"),

        NO_DIR_READ_ACCESS(100002,"无工作文件夹读权限"),

        NO_FILE_READ_ACCESS(100003,"无工作文件读权限"),

        CONFIG_FILE_CREATE_FAILURE_ERROR(200000,"配置文件创建失败"),

        CONFIG_FILE_FORMAT_ERROR(200001,"配置文件格式错误"),

        IO_CLOSE_FAILURE_ERROR(300000,"流关闭失败"),

        FILE_NOT_FOUND_ERROR(300001,"文件未找到");

        private int code;

        private String message;

        private M3U8ExceptionType(int code, String message){
            this.code = code;
            this.message = message;
        }
    }

}
